/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.common.publicity.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.common.publicity.dto.CasePublicityListPageRequest;
import com.icinfo.cloud.provider.punish.common.publicity.dto.CasePublicityModifyRecordDetailQueryDto;
import com.icinfo.cloud.provider.punish.common.publicity.dto.CasePublicityModifyRecordPageRequest;
import com.icinfo.cloud.provider.punish.common.publicity.service.ICasePublicityModifyRecordService;
import com.icinfo.cloud.provider.punish.common.publicity.vo.CasePublicityListVo;
import com.icinfo.cloud.provider.punish.common.publicity.vo.CasePublicityModifyRecordDetailVo;
import com.icinfo.cloud.provider.punish.common.publicity.vo.CasePublicityModifyRecordVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: 公示记录表 case_publicity_modify_record 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年10月13日
 */
@RestController
@RefreshScope
@RequestMapping("/punish/common/publicity/modifyRecord")
@Slf4j
public class CasePublicityModifyRecordController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(CasePublicityModifyRecordController.class);

    @Resource
    private ICasePublicityModifyRecordService casePublicityModifyRecordService;

    /**
     * 【V1.5.0】描述：获取公示管理列表
     *
     * @param queryDto 查询dto
     * @return {@link Result<PageResponse<CasePublicityListVo>> }
     * @author shishengyao
     * @date 2022/10/13
     */
    @PostMapping("/getPublicityList")
    @ApiOperation(value = "【V1.5.0】描述：获取公示管理列表", httpMethod = "POST")
    public Result<PageResponse<CasePublicityListVo>> getPublicityList(@RequestBody @Validated CasePublicityListPageRequest queryDto) {
        List<CasePublicityListVo> voList = casePublicityModifyRecordService.getPublicityPageList(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(voList));
    }


    /**
     * 【V1.5.0】描述：获取公示变更列表
     *
     * @param queryDto 查询dto
     * @return {@link Result<PageResponse<CasePublicityModifyRecordVo>> }
     * @author shishengyao
     * @date 2022/10/13
     */
    @PostMapping("/getPublicityModifyList")
    @ApiOperation(value = "【V1.5.0】描述：获取公示变更列表", httpMethod = "POST")
    public Result<PageResponse<CasePublicityModifyRecordVo>> getPublicityModifyList(@RequestBody @Validated CasePublicityModifyRecordPageRequest queryDto) {
       List<CasePublicityModifyRecordVo> voList = casePublicityModifyRecordService.getPublicityModifyPageList(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(voList));

    }
    /**
     * 【V1.5.0】描述：获取公示详情
     *
     * @param queryDto 查询dto
     * @return {@link Result<PageResponse<CasePublicityModifyRecordVo>> }
     * @author shishengyao
     * @date 2022/10/13
     */
    @PostMapping("/getCasePublicityRecordDetail")
    @ApiOperation(value = "【V1.5.0】描述：获取公示详情", httpMethod = "POST")
    public Result<List<CasePublicityModifyRecordDetailVo>> getCasePublicityRecordDetail(@RequestBody @Validated CasePublicityModifyRecordDetailQueryDto queryDto) {
        List<CasePublicityModifyRecordDetailVo> voList = casePublicityModifyRecordService.getCasePublicityRecordDetail(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, voList);
    }

    /**
     * 【V1.5.0】描述：根据拱手iid删除公示记录
     *
     * @param id id
     * @return {@link Result<List<CasePublicityModifyRecordDetailVo>> }
     * @author shishengyao
     * @date 2022/10/20
     */
    @GetMapping("/removeCasePublicityModifyRecordDetail")
    @ApiOperation(value = "【V1.5.0】描述：获取公示详情", httpMethod = "GET")
    public Result<List<CasePublicityModifyRecordDetailVo>> removeCasePublicityModifyRecordDetail(@RequestParam("publicityModifyRecordId") String publicityModifyRecordId) {
        int voList = casePublicityModifyRecordService.removeCasePublicityModifyRecordDetail(publicityModifyRecordId);
        return Result.success(Constant.STRING_GET_SUCCESS);
    }
}
